/*
 * @Description: 档案导出相关接口
 * @Author: Rfan
 * @Date: 2022-06-22 11:03:38
 * @LastEditTime: 2022-09-29 14:15:56
 */

import request from '@/utils/request';
import type { ICoordinate } from '@/interfaces/global';

/**
 * @description: 档案流转相关接口
 */
// 自动组卷参数类型
export interface IAutoFilingParams {
  toDb: string;
  coordinate: ICoordinate;
  movingEntryInfo: {
    entryIdList: number[];
    searchCondition?: string;
  };
}

// 自动组卷
export function autoFilingMethod(data: IAutoFilingParams) {
  return request({
    url: `/archive-moving/auto-folder`,
    method: 'post',
    data
  });
}

// 档案流转参数类型
export interface ITransferInArchiveParams extends IAutoFilingParams {
  entryId: number;
}
// 移入档案库
export function transferInArchiveMethod(data: ITransferInArchiveParams) {
  return request({
    url: `/archive-moving/to-db`,
    method: 'post',
    data
  });
}

export interface ICirculationArchivesParams extends IAutoFilingParams {
  fromDb: string;
}
// 档案流转
export function circulationArchivesMethod(data: ICirculationArchivesParams) {
  return request({
    url: `/archive-moving/`,
    method: 'post',
    data
  });
}

export interface IBreakUpArchivesParams extends Omit<IAutoFilingParams, 'toDb'> {
  fromDb: string;
}
// 案卷打散
export function breakUpArchivesMethod(data: IBreakUpArchivesParams) {
  return request({
    url: `/archive-moving/break-up-folder`,
    method: 'post',
    data
  });
}
